import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Layout from '@/views/Layout.vue'
import LoginView from '../views/LoginView.vue'
import NoticeView from '../views/NoticeView.vue'
import productAdd from '../views/productAddView.vue'
import productList from '@/views/productLIstView.vue'
import pro from '@/views/proView.vue'
import AddView from '@/views/AddView.vue'
import commentView from '@/views/commentView.vue'
import lunboView from '@/views/lunboView.vue'
import lunboAddView from '@/views/lunboAddView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      redirect:'/home',
      children:[
        {
          path: '/',
          name: 'home',
          component: HomeView,
        },
        {
          path: 'user',
          name: 'user',
          component:() => import('../views/UserView.vue'),
        },
        {
          path: 'notice',
          name: 'notice',
          component:() => import('../views/NoticeView.vue'),
        },
        {
          path: '/about',
          name: 'about',
          component: () => import('../views/AboutView.vue'),
        },
        {
          path: '/proadd',
          name: 'proadd',
          component: productAdd,
        },
        {
          path: '/prolist',
          name: 'prolist',
          component: productList,
        },
        {
          path: '/pro',
          name: 'pro',
          component: pro,
        },
        {
          path: '/add',
          name: 'add',
          component: AddView,
        },
        {
          path: '/comment',
          name: 'comment',
          component: commentView,
        },
        {
          path: '/lunbo',
          name: 'lunbo',
          component: lunboView,
        },
        {
          path: '/lunboadd',
          name: 'lunboadd',
          component: lunboAddView,
        },
       
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
  ],
})

export default router
